package mvv.learn.spring.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/")
public class WelcomeController extends AbsController {
	@RequestMapping(method = RequestMethod.GET)
	public String greeting1() {
		return greeting();
	}

	@RequestMapping(value = "/welcome/index", method = RequestMethod.GET)
	public String greeting() {
		return "default";
	}

	@RequestMapping(value = "/json", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	@ResponseBody
	public List<String> testJson() {
		ArrayList<String> array = new ArrayList<String>();
		array.add("Hello");
		array.add("the");
		array.add("world");
		array.add("!");
		return array;
	}
}
